<?php
	echo "<h1> Lecturer: ".ucfirst($lecturer['username'])."'s Profile</h1><br>";
	
	// Get Courses and resources
	$courses = $this->MLecturers->getCourses($lecturer['uid']);
	if ( count($courses) )
	{
		foreach ($courses as $key => $list){
			echo "<div class='box-resource'>";
			echo '<h3>'.$list['title'].'</h3>';
			echo '<p>'.$list['longdesc'].'</p>';
			$resources = $this->MLecturers->getResourceByCourse($list['course_id'], $lecturer['uid']);
			if (count($resources)){
				echo '<table cellpadding="0" cellspacing="0" border="0" class="bordered-table zebra-striped" id="example">';
				echo "<thead><tr valign='top'>";
				echo "<th>Resource type</th><th>Resource</th><th>Semester</th><th>Shift</th><th>Group</th><th>Year</th><th>Download</th>";
				foreach ($resources as $key => $item){
					echo "<tr valign='top'>";
					echo "<td align='center'>".$item['file_type']."</td>";
					echo "<td align='center'>";
					$extension = pathinfo($item['file_src'], PATHINFO_EXTENSION);
					if (strtolower($extension)=='gif' || strtolower($extension)=='jpg' || strtolower($extension)=='png') {
						echo "<img title='view image' class='img-popup' style='style:width:55px; height:55px;'  src=".base_url().'images/'.$lecturer['username'].'/'.$item['file_src']." />";			
					}
					elseif (strtolower($extension)=='flv' || strtolower($extension)=='mp4' || strtolower($extension)=='dat' || strtolower($extension)=='avi' ){
						echo "<a href='#'>".$item['file_src']."</a>";
					}
					else{
						echo "<a href='#'>".$item['file_src']."</a>";
					} 
					echo "</td>";
					echo "<td align='center'>".$item['semester']."</td>";
					echo "<td align='center'>".$item['shift']."</td>";
					echo "<td align='center'>".$item['group']."</td>";
					echo "<td align='center'>".$item['year']."</td>";
					echo "<td class='nofollow' align='center'>";
					echo form_open('lecturers/download');
					/*echo validation_errors();
					echo $cap_img.'<br />';
					$data = array('name'=>'captcha','id'=>'captcha','size'=>10);
					echo form_input($data);*/
					echo form_hidden('username', $username);
					echo form_hidden('file_src', $item['file_src']);
					echo form_submit(array('class'=>'btn','name'=>'submit'),'Download');
					echo form_close();
					echo "</td>";
					echo "</tr>";
				}	
				echo '</table>';
			}
			echo "</div>";
		}
	}
?>